package com.company.www.common;

import lombok.Data;

import java.io.Serializable;

@Data
public class ResponseResult implements Serializable {

    private static final long serialVersionUID = -7840098950026060881L;

    private int code = 200;

    private String msg = "OK";

    private Object data;

    public ResponseResult() {

    }

    public ResponseResult(String msg) {
        this.msg = msg;
    }

    public ResponseResult(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public ResponseResult(Object data) {
        this.data = data;
    }

    public static ResponseResult ok() {
        return new ResponseResult();
    }

    public static ResponseResult ok(String msg) {
        return new ResponseResult(msg);
    }

    public static ResponseResult ok(Object data) {
        return new ResponseResult(data);
    }

    public static ResponseResult error() {
        return new ResponseResult(500, "ERROR");
    }

    public static ResponseResult error(String msg) {
        return new ResponseResult(500, msg);
    }
}
